package thread.test_1;

public class Test9 {
    public static void main(String[] args) {
        You you = new You();
        you.setName("奈奈子");
        YourFriends yourFriends = new YourFriends();
        yourFriends.setName("nanako");

        // 将you设置为守护线程
        // 守护线程会在其他线程执行完毕后的一段时间死亡
        you.setDaemon(true);
        you.start();
        yourFriends.start();
    }
}
class You extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 2000; i++) {
            System.out.println(getName() + "跑了" + i + "米");
        }
    }
}
class YourFriends extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 20; i++) {
            System.out.println(getName() + "跑了" + i + "米");
        }
    }
}